from Tkinter import *

import Image

import imageCanvas
reload(imageCanvas)


class AutoShownScrollbar(Scrollbar):
    """ A scrollbar that hides itself if it's not needed.
    only works if you use the grid geometry manager.

    """
    def set(self, low, high):
        if float(low) <= 0.0 and float(high) >= 1.0:
            self.grid_remove()
        else:
            self.grid()
        Scrollbar.set(self, low, high)
        
    def pack(self, **kw):
        raise TclError, "cannot use pack with this widget"
    
    def place(self, **kw):
        raise TclError, "cannot use place with this widget"


